package com.atguigu04.compare.comparable;

import com.atguigu04.compare.Product;

import java.util.Arrays;

/**
 * ClassName: comparableTest
 * Package: com.atguigu04.compare.comparable
 * Description:
 *
 * @Author BuTang
 * @Create 2023/5/25 18:26
 * @Version 1.0
 */
public class comparableTest {
    public static void main(String[] args) {
        Product[] a = new Product[5];
        a[0] = new Product("HuaweiMate50pro",6299);
        a[1] = new Product("Xiaomi13pro",4999);
        a[2] = new Product("VivoX90pro",5999);
        a[3] = new Product("Iphone14ProMax",9999);
        a[4] = new Product("HonorMagic4",6299);
        Arrays.sort(a);
        for (int i = 0; i < a.length; i++) {
            System.out.println(a[i].getPrice()+a[i].getName());
        }
    }

}
